require.config({
	baseUrl: document.getElementById("resDomain").href + "/js/",
	//urlArgs: "r=" +  (new Date()).getTime(),
	paths: {
        js: './',
        jquery: './jquery-1.11.3.min',
        bootstrap: './bootstrap-3.3.5/bootstrap.min',
        validator: './nice-validator-1.1.4/local/zh-CN',
        validator_core: './nice-validator-1.1.4/jquery.validator.min.js?css',
        'bootstrap-select': './bootstrap-select-1.13.2/bootstrap-select.min',
        icheck: './icheck.min',
        pager: './pagectrl.js',
        jweixin: './jweixin-1.2.0',
        fastclick: './fastclick',
        qrcode: './qrcode.min',
        media: './html5media-1.1.8/html5media.min'
        	
    },
	shim: {
		'bootstrap': {
			deps: ['jquery'],
			exports: 'bootstrap'
		},
		'validator': {
			deps: ['jquery', 'validator_core'],
			exports: 'validator'
		}
	}
});

define(["bootstrap"],function() {
	
	window.Common = (function() {
		return {};
	})();
	
	Common.setSessionStorage = function(key, data) {
		if (!sessionStorage) {
			return;
		}
		sessionStorage.setItem(key, data);
	};
	Common.getSessionStorage = function(key) {
		if (!sessionStorage) {
			return null;
		}
		return sessionStorage.getItem(key);
	};
	Common.clearSessionStorage = function() {
		if (!sessionStorage) {
			return null;
		}
		sessionStorage.clear();
	};
	Common.setLocalStorage = function(key, data) {
		if (!localStorage) {
			return;
		}
		localStorage.setItem(key, data);
	};
	Common.getLocalStorage = function(key) {
		if (!localStorage) {
			return null;
		}
		return localStorage.getItem(key);
	};
	
	Common.referrer = function(defUrl, lazyTime) {
		$(document).showMsg("正在跳转...", 'pass');
		setTimeout(function() {
			if (document.referrer && document.referrer.indexOf("member/login") < 0) {
				location.href = document.referrer;
			} else {
				location.href = defUrl;
			}
		}, lazyTime !== undefined ? lazyTime : 2000);
	};
	Common.getUrlParams = function () {
		var index = location.href.indexOf("\?");
		if (index > -1) {
			return location.href.substr(index);
		}
		return "";
	}
	
	Common.geoLocation = function(opt) {
		var option = {
			after: opt.after ? opt.after : function(){},
			before: opt.before ? opt.before : function(){},
			error: opt.error ? opt.error : function(){},
			isRefresh: opt.isRefresh,
			isWatch: opt.isWatch
		};
		var KEY = "geoPosition";
		var watchId = -1;
		var position = Common.getLocalStorage(KEY);
		
		if (!option.isRefresh && position) {
			
			var latLng = position.split(",");
			option.after(latLng[0], latLng[1]);
			
			if (option.isWatch) {
				getLocation_();
			} else {
				// 仅为了刷新位置缓存
				option.after = function(){};
				option.before = function(){};
				option.error = function(){};
				getLocation_();
			}
			
		} else {
			getLocation_();
		}
		
		function getLocation_() {
			if (navigator.geolocation) {
				var geoOptions = {
					//enableHighAccuracy: true,
					//timeout: 20000
				};
				option.before();
				if (option.isWatch) {
					watchId = navigator.geolocation.watchCurrentPosition(showPosition_, showError_, geoOptions);
				} else {
					navigator.geolocation.getCurrentPosition(showPosition_, showError_, geoOptions);
				}
				
		    } else {
		    	option.error("当前浏览器不支持位置信息");
		    }
		}
		
		
		function showPosition_(position) {
			
			var lat=position.coords.latitude;
			var lng=position.coords.longitude;
			
			setLocalStorage(KEY, lat + "," + lng);
			
			option.after(lat, lng);
			
		}
		
		function showError_(error) {
			
			navigator.geolocation.clearWatch(watchId);
			
			switch(error.code) {
			case error.PERMISSION_DENIED:
				option.error("位置信息未启用");
			  break;
			case error.POSITION_UNAVAILABLE:
				option.error("位置信息不可用");
			  break;
			case error.TIMEOUT:
				option.error("位置信息获取超时");
			  break;
			case error.UNKNOWN_ERROR:
				option.error("位置信息错误");
			  break;
			}
		}
	};

	/**
	 * 两经纬度距离(单位:米)
	 * @param latA
	 * @param lngA
	 * @param latB
	 * @param lngB
	 * @returns {Number}
	 */
	Common.getDistance = function(latA, lngA, latB, lngB) {
		var EARTH_RADIUS = 6378137.0;
		var radLat1 = (latA * Math.PI / 180.0);
		var radLat2 = (latB * Math.PI / 180.0);
		var a = radLat1 - radLat2;
		var b = (lngA - lngB) * Math.PI / 180.0;
		var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
				+ Math.cos(radLat1) * Math.cos(radLat2)
				* Math.pow(Math.sin(b / 2), 2)));
		s = s * EARTH_RADIUS;
		s = Math.round(s * 10000) / 10000;
		return s;
	};

	Common.log = function(msg) {
		console ? console.log(msg) : void(0);
	};
	
	String.prototype.parse = function(name, value) {
		name = name.replace(/\./g, "\\.");
		return this.replace(new RegExp("\\-\\{" + name + "\\}\\-", "g"), value);
	};
	String.prototype.toTimestamp = function() {
		return new Date(this.replace(/-/g,"/")).getTime();
	};
	String.prototype.parseData = function(data) {
		var that = this;
		parse_(data, null);
		
		function parse_(data, nodeName) {
			var fullKey;
			for (var key in data) {
				fullKey = nodeName? (nodeName + '.' + key) : key;
				if ($.isPlainObject(data[key])) {
					parse_(data[key], fullKey);
				} else {
					that = that.parse(fullKey, data[key]);
				}
			}
		}
		return that;
	}
	window.String.prototype.eeqp = function() {//excludeEmptyQueryParam
		return this.replace(/&\w+\.?\w+\=&/g, "&").replace(/\w+\.?\w+\=&/g, "");
	};

	
	// 日期类扩展
	Date.prototype.format = function(fmt) { //author: meizz   
	  var o = {   
	    "M+" : this.getMonth()+1,                 //月份   
	    "d+" : this.getDate(),                    //日   
	    "h+" : this.getHours(),                   //小时   
	    "m+" : this.getMinutes(),                 //分   
	    "s+" : this.getSeconds(),                 //秒   
	    "q+" : Math.floor((this.getMonth()+3)/3), //季度   
	    "S"  : this.getMilliseconds()             //毫秒   
	  };   
	  if(/(y+)/.test(fmt)) {
	  	fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));  
	  }  
	     
	  for(var k in o) {
	    if(new RegExp("("+ k +")").test(fmt))   {
	  		fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));   
	    }
	  }
	  return fmt;   
	};
	Date.prototype.daysInMonth = function() {  
	     return new Date(this.getFullYear() + "/"+ (this.getMonth() + 1) +"/0").getDate();
	};
	Date.prototype.distance = function(date) {
		
		var startDate = this;
		var endDate = date;
		if (startDate.getTime() > date.getTime()) {
			startDate = date;
			endDate = this;
		}

		var startParts = startDate.format("yyyy_MM_dd_hh_mm").split(/_/);
		var endParts = endDate.format("yyyy_MM_dd_hh_mm").split(/_/);
		var distance = "";
		var subtractHour = 0;
		var subtractDay = 0;
		var subtractMonth = 0;
		if (parseInt(endParts[4]) > parseInt(startParts[4])) {
			distance = (parseInt(endParts[4]) - parseInt(startParts[4])).toFixed(0) + "分钟" + distance;
		} else if (parseInt(endParts[4]) < parseInt(startParts[4])) {
			distance = (60 - parseInt(startParts[4]) + parseInt(endParts[4])).toFixed(0) + "分钟" + distance;
			subtractHour = 1;
		}
		if (parseInt(endParts[3]) - subtractHour > parseInt(startParts[3])) {
			distance = (parseInt(endParts[3]) - subtractHour - parseInt(startParts[3])).toFixed(0) + "小时" + distance;
		} else if (parseInt(endParts[3]) < parseInt(startParts[3])) {
			distance = (24 - (parseInt(startParts[3]) - subtractHour) + parseInt(endParts[3])).toFixed(0) + "小时" + distance;
			subtractDay = 1;
		}
		if (parseInt(endParts[2]) - subtractDay > parseInt(startParts[2])) {
			distance = (parseInt(endParts[2]) - subtractDay - parseInt(startParts[2])).toFixed(0) + "天" + distance;
		} else if (parseInt(endParts[2]) < parseInt(startParts[2])) {
			distance = (startDate.daysInMonth() - (parseInt(startParts[2]) - subtractDay) + parseInt(endParts[2])).toFixed(0) + "天" + distance;
			subtractMonth = 1;
		}
		if (parseInt(endParts[1]) - subtractMonth > parseInt(startParts[1])) {
			distance = (parseInt(endParts[1]) - subtractMonth - parseInt(startParts[1])).toFixed(0) + "个月" + distance;
		} else if (parseInt(endParts[1]) - subtractMonth < parseInt(startParts[1])) {
			distance = (12 - (parseInt(startParts[1]) - subtractMonth) + parseInt(endParts[1])).toFixed(0) + "个月" + distance;
		}
		if (parseInt(endParts[0]) > parseInt(startParts[0])) {
			distance = (parseInt(endParts[0]) - parseInt(startParts[0])).toFixed(0) + "年" + distance;
		}
		return distance;
		
	};
	Date.prototype.name = function(){
		var date = this;
		var year = date.getFullYear();
		var mon = date.getMonth();
		var dat = date.getDate();
		var hour = date.getHours();
		var min = date.getMinutes();
		var sec = date.getSeconds();
		var curDate  = new Date();
		var curYear = curDate.getFullYear();
		var curMon = curDate.getMonth();
		var curDat = curDate.getDate();
		var curHour  = curDate.getHours();
		var curMin = curDate.getMinutes();
		var str = "";
		
		if(curYear-year ==0){
			if(curMon-mon >1){
				str +=(mon+1)+"月"+dat+"日";
			}
			else if(curMon-mon ==1){
				str +="上月"+dat+"日";
			}
			else{
				if(curDat-dat==0){
					str +="今天";
				}
				else if(curDat-dat==1){
					str +="昨天";
				}
				else if(curDat-dat==2){
					str +="前天";
				}
				else{
					str +=dat+"日";
				}
			}
		}
		else{
			if(curYear-year>2){
				str += year+"年";
			}
			else if(curYear-year ==2){
				str += "前年";
			}
			else if(curYear-year ==1){
				str += "去年";
			}
			
			str +=(mon+1)+"月"+dat+"日";
			
		}
		if(hour>18){
			str +="晚上"+(hour-12)+"点";
		}
		else if(hour>12){
			str +="下午"+(hour-12)+"点";
		}
		else if(hour==12){
			str +="中午"+hour+"点";
		}
		else if(hour>6){
			str +="上午"+hour+"点";
		}
		else{
			str +="零晨"+hour+"点";
		}
		if(min==30){
			str +="半";
		}
		else if(min==0){
			str +="整";
		}
		else{
			str +=min+"分";
		}
		return str;
	};
	
	var UrlParam = function() {
		this.params = {};
		this.paramsStr = "";
		var locHref = location.href;
		var startIndex = locHref.indexOf("\?");
		if (startIndex > -1) {
			var endIndex = locHref.indexOf("\#");
			if(endIndex > 0){
				paramsStr = locHref.substring(startIndex+1,endIndex);
			}
			else{
				paramsStr = locHref.substring(startIndex+1);
			}
			paramsStr = decodeURIComponent(paramsStr);
			paramsStr = '{"'+paramsStr.replace(/\&/g,'","').replace(/\=/g,'":"')+'"}';
			try {
			this.params = $.parseJSON(paramsStr);
			} catch(e) {};
		}
	};
	UrlParam.prototype.getDefStr = function() {
		return $.param(this.params);
	};
	UrlParam.prototype.getStr = function() {
		return $.param(this.params);
	};
	UrlParam.prototype.get = function() {
		return this.params;
	};
	UrlParam.prototype.getParam = function(key) {
		return this.params[key];
	};
	UrlParam.prototype.setParam = function(key, value) {
		this.params[key] = value;
	};
	UrlParam.prototype.removeParam = function(key) {
		this.params[key] = undefined;
	};
	
	window.UrlParam = new UrlParam();
	
	$.fn.extend({
		// 滚动加载
		scrollLoad: function(callback) {
			var $that = this;
			if (!callback) {
				load_();
				return $that;
			}
			var eventName = 'lazyWork';
			var isDoing = false;
			
			$(document).on(eventName, $that.selector, function() {
				var $target = $(this);
				var elHeight = $target.height();
				var elTop = $target.offset().top;
				var wHeight = $(window).height();
				var wScrollTop = $(window).scrollTop();
				if ((wScrollTop >= elTop && wScrollTop < (elTop + elHeight)) || (wScrollTop < elTop && (wScrollTop + wHeight) >= elTop) ) {
					callback($target);
				}
			});
			
			$(window).scroll(load_);
			$(window).scroll();
			
			function load_() {
				if (isDoing) return;

				isDoing = true;
				setTimeout((function(selector) {
					return function() {
						$(selector).each(function() {
							$(this).trigger(eventName);
						});
						isDoing = false;
					};

				})($that.selector));
			}
			return $that;
		},
		// 操作锁
		isLocked: function() {
			return this.data('locked');
		},
		lock: function() {
			if (this.isLocked()) {
				return false;
			}
			this.data("locked", true);
			return true;
		},
		unlock: function(rightNow) {
			var $this = this;
			if (!rightNow) {
				setTimeout(function() {
					$this.removeData("locked");
				},1000);
			} else {
				$this.removeData("locked");
			}
			return $this;
		},
		// 加载状态
		isLoading: function() {
			return this.data("loading");
		},
		loading: function() {
			return this.data("loading", true); 
		},
		loaded: function() {
			return this.data("loading", false); 
		},
		// 操作提示
		defMsg: function(msg, type) {
			var $this = this;
			
			// 如果执行的是加载,则延迟0.5秒显示, 如果0.5秒后还没有加载完再显示
			if (type === 'load') {
				clearTimeout($this.data("msg_timeout_index"))
				var index = setTimeout(function() {
					if ($this.isLoading()) {
						if (hasMsg_()) {
							resetMsg_();
						} else {
							setMsg_();
						}						
					}
				}, 500);				
				$this.data("msg_timeout_index", index);
				
			} else {
				if (hasMsg_()) {
					resetMsg_();
				} else {
					setMsg_();
				}
			}
			
			function hasMsg_() {
				return $this.data('hasMsg');
			}
			
			function resetMsg_() {
				$this.trigger('changeMsg', [msg, type]);
			}
			
			function setMsg_() {
				var $el = $('.tipbox');
				if ($el.length === 0) {
					$el = $("<div class='tipbox'></div>");
					$("body").prepend($el);
				}
				var $tip = $('<div class="alert"></div>');
				$el.append($tip);
				$el.append('<div class="clearfix"></div>');
				
				$this.data('hasMsg', true);
				
				$this.on('changeMsg', function(event, msg, type) {
					$tip.removeClass("load fail");
					$tip.addClass(type);
					$tip.html(msg);
					if (type !== 'load') {
						$tip.stop(true,true).show().delay(3000).fadeOut(function() {$tip.hide();});
					} else {
						$tip.show();
					}
					return false;
				});
				$this.on('hideMsg', function() {
					$tip.fadeOut();
					return false;
				});
				
				$this.trigger('changeMsg', [msg, type]);
			} 
			
			return $this;
		},
		hideMsg: function() {
			return this.loaded().unlock(true).trigger('hideMsg');
		},
		infoMsg: function(msg) {
			return this.loaded().unlock().defMsg(msg);
		},
		loadMsg: function(msg) {
			return this.loading().defMsg(msg, 'load');
		},
		failMsg: function(msg) {
			return this.loaded().unlock().defMsg(msg, 'fail');
		},
		dataObj: function() {
			var dataObj = {}, node = {};
			$(this).find("input[type='text'],input[type='hidden'],input[type='number'],input[type='email'],input[type='password'],input[type='radio']:checked,input[type='checkbox']:checked,select,textarea")
			.each(function(i, el) {
				var namePath = $(el).attr("name");
				if (!namePath) return;
				var names = namePath.split(".");
				createNode_(names, 0, dataObj, $(el).val());
			});
			
			function createNode_(names, k, node, value) {
				var name = names[k];
				if (name.indexOf("[") != -1) {
					var i = parseInt(name.substring(name.indexOf("[") + 1, name.indexOf("]")));
					name = name.substring(0, name.indexOf("["));
					if (!node[name]) {
						node[name] = [];
					}
					if (!node[name][i]) {
						node[name][i] = {};
					}
					if (++k < names.length) {
						createNode_(names, k, node[name][i], value);
						return;
					}
					node[name][i] = value;;
				} else if (!node[name]) {
					node[name] = {};
				}
				if (++k < names.length) {
					createNode_(names, k, node[name], value);
					return;
				}
				node[name] = value;
			};
			
			return dataObj;
		},
		dataJson: function(dataObj) {
			if (dataObj) {
				return JSON.stringify(dataObj);
			}
			return JSON.stringify($(this).dataObj());
		},
		// 初始化表单值
		initData: function(data) {
			var $this = this;
			
			setValue_(data, null);
			
			function setValue_(data, nodeName) {
				var fullKey;
				for (var key in data) {
					fullKey = nodeName? (nodeName + '.' + key) : key;
					if ($.isPlainObject(data[key])) {
						setValue_(data[key], fullKey);
					} else {
						$input = $this.find("[name='" + fullKey + "']");
						if ($input.is(":checkbox")) {
							$input.filter("[value='" + data[key] + "']").prop("checked", true);
						} else if ($input.is(":radio")) {
							$input.prop("checked", false);
							$input.filter("[value='" + data[key] + "']").prop("checked", true);
						} else {
							$input.val(data[key]);
						}
					}
				}
			}
		},
		// 解析页面模板
		parseHtml: function(option) {
			var opt = {
				data: null,
				itemSelector: null,
				beforeNode: {},
				afterNode: {},
				node: "root"
			};
			for (var key in option) {
				opt[key] = option[key];
			}
			
			this.each(function(i, el) {
				var $this = $(this);
				var tpl = $this.data("tpl");
				if (!tpl) {
					if (opt.itemSelector) {
						tpl = $this.find(opt.itemSelector).html();					
					} else {
						tpl = $this.html();
						$this.empty();
					}
					if ($this.css("display") == "none") {
						$this.css("display", "");
					}
					$this.data("tpl", tpl);
				}
				if ($.isArray(opt.data)) {
					var Data = function(){};
					Data.prototype = opt.data;
					var data = new Data();
					for (var i in data) {
						parseArrayItem_($this, data[i]);
					}
				} else if (opt.data) {
					var Data = function(){};
					Data.prototype = opt.data;
					parseArrayItem_($this, new Data());
				}
				
			});
			
			function parseArrayItem_($this, data) {
				var itemHtml = $this.data("tpl");
				if (opt.beforeNode[opt.node]) {
					(opt.beforeNode[opt.node])(data);
				}
				itemHtml = parsePlainObject_(data, itemHtml, opt.node == 'root' ? null : opt.node);
				$this.append(itemHtml);
				if (opt.afterNode[opt.node]) {
					(opt.afterNode[opt.node])(data);
				}
			}
			
			function parsePlainObject_(data, itemHtml, node) {					
				var curNode;
				for (var key in data) {
					curNode = node? (node + '.' + key) : key;
					if ($.isArray(data[key])) {
						var $sub = $("<div>").append(itemHtml);
						var subOption = {
							data: data[key],
							beforeNode: opt.beforeNode,
							afterNode: opt.afterNode,
							node: curNode
						};
						$sub.find("[data-node='" + curNode + "']").parseHtml(subOption);
						itemHtml = $sub.html();
					} else {
						if (opt.beforeNode[curNode]) {
							(opt.beforeNode[curNode])(data[key]);
						}						
						if ($.isPlainObject(data[key])) {
							itemHtml = parsePlainObject_(data[key], itemHtml, curNode);
						} else {
							if (data[key] == null) {
								itemHtml = itemHtml.parse(curNode, "");
							} else {
								itemHtml = itemHtml.parse(curNode, data[key]);
							}							
						}
						if (opt.afterNode[curNode]) {
							(opt.afterNode[curNode])(data[key]);
						}
					} 						
				}
				return itemHtml;
			}
			return this;
		},
		id: function(i) {
			if (!i) {
				return this.attr("id");
			}
			return (this.attr("id").split("_"))[i];
		},
		its: function(attrValue) {
			return this.find("[its=" + attrValue + "]");
		},
		showLoading: function() {
			var that = this;
			clearTimeout(that.loadIndex);
			that.loadIndex = setTimeout(function() {
				that.addClass("bg-loading");
			}, 500);
			
		},
		hideLoading: function() {
			clearTimeout(this.loadIndex);
			this.removeClass("bg-loading");
		},
		// 轮翻
		swipe: function(option) {
			if (!option) {
				option = {};
			}
			var opt = {
				speed: option.speed ? option.speed : 600,
				timeout: option.timeout ? option.timeout : 6000
			}
			var $swipe = this;
    		var id = $swipe.find(".slider").attr("id");
    		var slider = new TouchSlider({
    			id: id, 
    			speed: opt.speed, 
    			timeout: opt.timeout, 
    			before:(function($swipe){
    				return function(index) {
    					$swipe.find(".pagenavi a").removeClass("active");
    					$swipe.find(".pagenavi a:eq(" + index + ")").addClass("active");
    				}        				
        		})($swipe)
        	});
    		$swipe.find(".pagenavi a").each(function(i, el) {
    			$(this).click((function(slider, i) {
    				return function() {
    					slider.slide(i);
    					return false;
    				}
    			})(slider, i));
    		});
		},
		// 透明度
		opacity: function() {
			var that = this;
			that.opacity0();
			setTimeout(function() {
				that.opacity1();
			},100);
			return this;
		},
		opacity0: function() {
			this.addClass("opacity0");
			this.removeClass("opacity1");
			return this;
		},
		opacity1: function() {
			this.addClass("opacity1");
			this.removeClass("opacity0");
			return this;
		},
		// 水平滚动
		horizontalScrolling: function(itemDuration) {
			if (!itemDuration) {
				itemDuration = 3000;
			}
			
    		var $list = this.find(".scroll-list");
      		var $clone = $list.children().clone();
      		var itemWidth = $list.children(":eq(0)").outerWidth();
      		var len = $clone.length;
      		var defSpeed = len * itemDuration;
      		var scrollWidth = len * itemWidth;
      		var listWidth = scrollWidth * 2;
      		$list.append($clone);
      		$list.width(listWidth);
      		$list.hover(function() {
      			$(this).stop();
      		}, function() {
      			// 根据当前滚动位置重新计算速度
      			var remainLeft = scrollWidth - Math.abs(parseInt($list.css("margin-left").replace("px", "")));
      			var speed2 = remainLeft / itemWidth * itemDuration;
      			scroll_(speed2);
      		});
      		
      		scroll_(defSpeed);
      		
      		function scroll_(speed) {
      			$list.animate({
          			"margin-left": -scrollWidth
          		}, speed, 'linear', function() {
          			$list.css("margin-left", "0px");
          			scroll_(defSpeed);
          		});
      		}
		}		
	});

	
	// 域名变量
	(function() {
		var domainVars = "";
		$("link[rel='dns-prefetch']").each(function() {
			domainVars += "g_" + $(this).attr("id") + "='" + $(this).attr("href") + "';";
			eval("g_" + $(this).attr("id") + "='" + $(this).attr("href") + "';");
		});
		eval(domainVars);
	})();
	
	$(".navbar-title").html($("title").html());
	
	function commonInit() {
		var noPic = g_resDomain + "/images/pic-no.jpg";
		//图片懒加载
		$("img[data-src]:visible").scrollLoad(function($el) {
			
			$el.error(function() {
				$el.attr("src", noPic);
			});
			var src = $el.attr("data-src");
			$el.removeAttr("data-src");
			if (!src) {
				$el.attr("src", noPic);
				return;
			}
			// def 表示src不必替换为data-src, 即沿用原src
			if (src == 'def') {
				return;
			}			
			if (src.indexOf("http") !== 0) {
				src = g_attaDomain + src;
			}
			$el.attr("src", src);
		});
		/*
		//图片懒加载
		$("video[data-src]:visible").scrollLoad(function($el) {
			require(["media"], function() {
				var src = $el.attr("data-src");
				$el.removeAttr("data-src");
				if (!src) {
					return;
				}
				// def 表示src不必替换为data-src, 即沿用原src
				if (src == 'def') {
					return;
				}			
				if (src.indexOf("http") !== 0) {
					src = g_attaDomain + src;
				}
				$el.attr("src", src);
			});
			
		});
		*/
		//图片加载失败
		$("img").error(function() {
			$(this).attr("src", g_resDomain + "/images/pic-no.jpg");
		});

		// (ie兼容autofocus)
		$("[autofocus]").focus().select();
		
		require(["placeholder"], function() {
			$("input").placeholder();
		});
	}
	
});

